home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
enigma
/
earcd
/
comm
/
comm2
/
hdrbbs11.lh0
/
HBBS
/
Source
/
Test
/
TestFunc
/
Main.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-25
|
1KB
|
55 lines
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <exec/exec.h>
#include <exec/memory.h>
#include <exec/types.h>
void __asm __saveds strNcpy(register __a0 UBYTE *dest,register __a1 UBYTE *source,register __d0 int chars)
{
int count=0;
while ((dest[count]=source[count]) && count<chars-1) count++;
dest[count+1]=0;
}
short __asm __saveds position(register __a0 char *substr,register __a1 char *str)
{
// returns an character offset of a substring in a string
// this version is CASE SENSITIVE
// returns -1 if substring not found in the string
char *whstr;
return((short)((whstr=strstr(str,substr)) ? (short)((LONG)whstr-(LONG)str) : -1));
}
void cleartags( char*filenames)
{
char filename[512];
int where;
while (filenames[0]) // any chars left ?
{
while ((filenames[0]==' ') && (filenames[0])) filenames++; //skip spaces..
if (filenames[0])
{
if (where=position(" ",filenames))
{
strNcpy(filename,filenames,where);
puts(filename);
filenames+=where;
}
}
}
}
void main(int argc,char *argv[])
{
cleartags(" banana banana2 ");
}